//
//  TFLRightMenuViewController.m
//  netEasy
//
//  Created by mac on 15/11/1.
//  Copyright © 2015年 mac. All rights reserved.
//

#import "TFLRightMenuViewController.h"
#import "TFLRightViewCell.h"
@interface TFLRightMenuViewController ()
@property (weak, nonatomic) IBOutlet UIView *topView;

@property (weak, nonatomic) IBOutlet UIView *middleView;

@property (weak, nonatomic) IBOutlet UIView *bottomView;

@end

@implementation TFLRightMenuViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    //1.设置middleView的内部控件 260*480
    [self setupMiddleView];
    
    //2.设置底部bottomView的内部控件
    
}

-(void)setupMiddleView
{
    //1.添加所有的VIEWCELL子控件
    [self addAllViewCells];
    
    //2.设置所有其子控件的FRAME值
    [self addAllViewCellsFrames];
}

-(void)addAllViewCells
{
    //设置一个基本信息显示
    TFLRightViewCell * viewCell1 = [TFLRightViewCell RightViewCell];
    
    viewCell1.imageName = @"promoboard_icon_mall";
    
    viewCell1.detailLabelText = @"天天向上，天天向上，天天向上11";
    
    [self.middleView addSubview:viewCell1];
    
    //设置二个基本信息显示
    TFLRightViewCell * viewCell2 = [TFLRightViewCell RightViewCell];
    
    viewCell2.imageName = @"promoboard_icon_apps";
    
    viewCell2.detailLabelText = @"天天向上，天天向上，天天向上22";
    
    [self.middleView addSubview:viewCell2];
    
    //设置三个基本信息显示
    TFLRightViewCell * viewCell3 = [TFLRightViewCell RightViewCell];
    
    viewCell3.imageName = @"promoboard_icon_activities";
    
    viewCell3.detailLabelText = @"天天向上，天天向上，天天向上33";
    
    [self.middleView addSubview:viewCell3];

}

-(void)addAllViewCellsFrames
{
    TFLRightViewCell * oneCell = self.middleView.subviews.lastObject;
    CGFloat rightViewCellH = oneCell.height;
    CGFloat rightViewCellX = (self.middleView.width - oneCell.width)*0.5;
    
    NSInteger count = self.middleView.subviews.count;
    
    for (int i = 0; i < count; i++) {
        
        CGFloat rightViewCellY = i*rightViewCellH;
        
        TFLRightViewCell * cell = self.middleView.subviews[i];
        
        cell.x = rightViewCellX;
        
        cell.y = rightViewCellY;
        
    }
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
